//
//  YRJDestinationCollectionViewCell.m
//  TravelAroundTheWorld
//
//  Created by dllo on 15/10/22.
//  Copyright (c) 2015年 yanrenjie. All rights reserved.
//

#import "YRJDestinationCollectionViewCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation YRJDestinationCollectionViewCell
- (void)dealloc {
    [_photoImageView release];
    [_countLabel release];
    [_cityLabel release];
    [_cnnameLabel release];
    [_ennameLabel release];
    [_backgroundLabel release];
    
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell {
    self.photoImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.photoImageView];
    [_photoImageView release];
    
    self.countLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.countLabel];
    [_countLabel release];
    
    self.cityLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.cityLabel];
    [_cityLabel release];
    
    self.backgroundLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.backgroundLabel];
    self.backgroundLabel.backgroundColor = [UIColor colorWithRed:80 / 255.0 green:130 / 255.0 blue:170 / 255.0 alpha:0.6];
    [_backgroundLabel release];
    
    self.cnnameLabel = [[UILabel alloc] init];
    [self.backgroundLabel addSubview:self.cnnameLabel];
    [_cnnameLabel release];
    
    self.ennameLabel = [[UILabel alloc] init];
    [self.backgroundLabel addSubview:self.ennameLabel];
    [_ennameLabel release];

}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.photoImageView.frame = CGRectMake(0, 0, WIDTH, HEIGHT / 11 * 9);
    self.countLabel.frame = CGRectMake((100.0 / 160.0) * WIDTH, (10.0 / 220.0) * HEIGHT, (60.0 / 160.0) * WIDTH, (40.0 / 220.0) * HEIGHT);
    self.cityLabel.frame = CGRectMake((100.0 / 160.0) * WIDTH, (50.0 / 220.0) * HEIGHT, (60.0 / 160.0) * WIDTH, (20.0 / 220.0) * HEIGHT);
    self.backgroundLabel.frame = CGRectMake(0, HEIGHT / 11 * 9, WIDTH, (40.0 / 220.0) * HEIGHT);
    self.cnnameLabel.frame = CGRectMake((10.0 / 160.0) * WIDTH, 0, (100.0 / 160.0) * HEIGHT, (20.0 / 220.0) * HEIGHT);
    self.ennameLabel.frame = CGRectMake((10.0 / 160.0) * WIDTH, (20.0 / 220.0) * HEIGHT, (100.0 / 160.0) * WIDTH, (20.0 / 220.0) * HEIGHT);
    NSLog(@"%f", WIDTH);
    NSLog(@"%f", HEIGHT);
}
@end
